<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>新增</title>
    <link rel="stylesheet" href="/static/component/pear/css/pear.css"/>
    <link rel="stylesheet" href="/static/component/pear/css/input.css"/>
    <script src="/static/component/layui/layui.js"></script>
    <script src="/static/component/pear/pear.js"></script>
    <meta name="viewport" content="width=device-width,user-scalable=no, initial-scale=1">
</head>
<style>
    .layui-elem-field legend {
        margin-left: 20px;
        padding: 0 10px;
        font-size: 16px;

        font-weight: bold
    }

    .layui-form-item-required:before {
        display: inline-block;
        margin-right: 4px;
        color: #f5222d;
        font-size: 14px;
        font-family: SimSun, sans-serif;
        line-height: 1;
        content: "*";
    }
</style>
<form class="layui-form formData" action="Rn_add" method="post">
    <input type="hidden" name="id" value="{$rn_data['id']}">
    <input type="hidden" name="Rndata[listid]" value="{$rn_data['listid']}">
    <input type="hidden" name="Rndata[modeid]" value="{$rn_data['modeid']}">
    <div class="mainBox">
        <div class="main-container">
            <div class="main-container">
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-item-required">文档简介</label>
                    <div class="layui-input-block">
                        <textarea placeholder="" class="layui-textarea" name="Rndata[rn_text]" id="rn_text">{$rn_data['rn_text']}</textarea>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-item-required">详细介绍</label>
                    <div class="layui-input-block">
                        <textarea placeholder="" class="layui-textarea" name="Rndata[rn_text_long]" id="rn_text_long">{$rn_data['rn_text_long']}</textarea>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="bottom">
        <div class="button-container">
            <button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="save">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="pear-btn pear-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>

<script>
    var $ = layui.jquery;
    layui.use(['form', 'layer', 'tinymce', 'rncontrol'], function () {
        var layer = layui.layer
            , tinymce = layui.tinymce
            , form = layui.form;
        var edit0 = layui.tinymce.render({
            elem: "#rn_text_long",
            height: 500,
            images_upload_url: '/rncurd/Rnupload/shangchuan/?type=1'
        });


        form.on('submit(save)', function () {
            edit0.save();
            layer.load();
            $.ajax({
                url: '/admin/Rndoc/DocSave/',
                type: "POST",
                data: $('.formData').serialize(),
                success: function (res) {
                    layui.layer.closeAll('loading');
                    layui.layer.msg(res.msg);
                    if (res.code == "0") {
                        parent.shuaxin();
                        parent.layer.close(parent.layer.getFrameIndex(window.name));
                    }
                },
                error: function (e) {
                    layer.msg('操作失败,请联系技术人员', {icon: 2});
                }
            });
            return false;
        });

    })


</script>


</body>
</html>